package com.taobao.txc.common.util.d;

import com.taobao.txc.common.LoggerInit;
import com.taobao.txc.common.LoggerWrap;
import java.net.URL;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.apache.commons.lang.StringUtils;

public final class a
{
  private static final LoggerWrap a = LoggerInit.logger;
  private static final Package b = b.class.getPackage();
  private static final b c = (b)b.getAnnotation(b.class);
  
  public static String a()
  {
    return "2.0.72";
  }
  
  private static boolean a(String paramString, Set<String> paramSet)
  {
    if (paramSet == null) {
      return false;
    }
    Iterator localIterator = paramSet.iterator();
    while (localIterator.hasNext())
    {
      String str = (String)localIterator.next();
      if (paramString.indexOf(str) != -1) {
        return true;
      }
    }
    return false;
  }
  
  public static boolean a(String paramString1, String paramString2, String paramString3, Set<String> paramSet)
  {
    try
    {
      if (paramString3 == null) {
        return true;
      }
      Long localLong1 = b(paramString3);
      Enumeration localEnumeration = a.class.getClassLoader().getResources(paramString2);
      while (localEnumeration.hasMoreElements())
      {
        URL localURL = (URL)localEnumeration.nextElement();
        if (localURL != null)
        {
          String str1 = localURL.getFile();
          if ((str1 != null) && (str1.length() > 0) && (!a(str1, paramSet)))
          {
            String str2 = a(str1);
            a.info(paramString1 + " version is " + str2 + ",url:" + localURL.toString() + ",path:" + str1);
            if (c(str2))
            {
              Long localLong2 = b(str2);
              if (localLong2.longValue() < localLong1.longValue()) {
                throw new IllegalStateException("check " + paramString1 + " version is " + str2 + " < " + paramString3 + "(the minimum version), please upgrade " + paramString1 + " jar version");
              }
            }
          }
        }
      }
    }
    catch (Throwable localThrowable)
    {
      a.a("errorCode", localThrowable.getMessage(), localThrowable);
      if ("fastjson".equals(paramString1))
      {
        localThrowable.printStackTrace();
        System.exit(-1);
      }
    }
    return true;
  }
  
  public static boolean a(String paramString1, String paramString2, String paramString3)
  {
    return a(paramString1, paramString2, paramString3, null);
  }
  
  public static boolean a(String paramString1, String paramString2, String paramString3, String paramString4)
  {
    HashSet localHashSet = new HashSet();
    localHashSet.add(paramString4);
    return a(paramString1, paramString2, paramString3, localHashSet);
  }
  
  public static boolean a(String paramString, boolean paramBoolean)
  {
    try
    {
      Enumeration localEnumeration = a.class.getClassLoader().getResources(paramString);
      HashSet localHashSet = new HashSet();
      Object localObject;
      while (localEnumeration.hasMoreElements())
      {
        localObject = (URL)localEnumeration.nextElement();
        if (localObject != null)
        {
          String str = ((URL)localObject).getFile();
          if ((str != null) && (str.length() > 0)) {
            localHashSet.add(str);
          }
        }
      }
      if (localHashSet.size() > 1)
      {
        localObject = "Duplicate class " + paramString + " in " + localHashSet.size() + " jar " + localHashSet;
        if (paramBoolean) {
          throw new IllegalStateException((String)localObject);
        }
        a.error("errorCode", (String)localObject);
        return true;
      }
    }
    catch (Throwable localThrowable)
    {
      a.a("errorCode", localThrowable.getMessage(), localThrowable);
    }
    return false;
  }
  
  public static String a(String paramString)
  {
    if ((paramString != null) && (paramString.length() > 0) && (StringUtils.contains(paramString, ".jar")))
    {
      int i = StringUtils.lastIndexOf(paramString, ".jar");
      paramString = paramString.substring(0, i);
      int j = paramString.lastIndexOf('/');
      if (j >= 0) {
        paramString = paramString.substring(j + 1);
      }
      j = paramString.indexOf("-");
      if (j >= 0) {}
      for (paramString = paramString.substring(j + 1); (paramString.length() > 0) && (!Character.isDigit(paramString.charAt(0))); paramString = paramString.substring(j + 1))
      {
        j = paramString.indexOf("-");
        if (j < 0) {
          break;
        }
      }
      return paramString;
    }
    return null;
  }
  
  public static Long b(String paramString)
  {
    String[] arrayOfString1 = StringUtils.split(paramString, '.');
    Long localLong = Long.valueOf(0L);
    int i = 1;
    int j = arrayOfString1.length > 4 ? arrayOfString1.length : 4;
    for (String str : arrayOfString1)
    {
      if (StringUtils.isNumeric(str))
      {
        localLong = Long.valueOf(localLong.longValue() + Long.valueOf(str).longValue() * Double.valueOf(Math.pow(100.0D, j - i)).longValue());
      }
      else
      {
        String[] arrayOfString3 = StringUtils.split(str, '-');
        if (StringUtils.isNumeric(arrayOfString3[0])) {
          localLong = Long.valueOf(localLong.longValue() + Long.valueOf(arrayOfString3[0]).longValue() * Double.valueOf(Math.pow(100.0D, j - i)).longValue());
        }
      }
      i++;
    }
    return localLong;
  }
  
  private static boolean c(String paramString)
  {
    return (paramString != null) && (!StringUtils.contains(paramString, "with-dependencies")) && (!StringUtils.contains(paramString, "storm"));
  }
  
  static
  {
    a("com/alibaba/druid/pool/DruidDataSource.class", false);
    a("druid", "com/alibaba/druid/pool/DruidDataSource.class", "1.0.9");
    a("com/taobao/diamond/client/Diamond.class", false);
    a("diamond", "com/taobao/diamond/client/Diamond.class", "3.6.8");
    a("com/alibaba/fastjson/JSON.class", false);
    a("fastjson", "com/alibaba/fastjson/JSON.class", "1.1.36");
    a("com/mysql/jdbc/Driver.class", false);
    a("mysql", "com/mysql/jdbc/Driver.class", "5.1.34", "txc-driver");
    a("org/slf4j/impl/StaticLoggerBinder.class", false);
    a("tddl5", "com/taobao/tddl/matrix/jdbc/TDataSource.class", "5.1.23");
  }
}


/* Location:           C:\Users\ibm\Downloads\txc-yun-sample (1)\txc-yun-sample\lib\txc-client-2.0.72.jar
 * Qualified Name:     com.taobao.txc.common.util.d.a
 * JD-Core Version:    0.7.0.1
 */